package mlc.om.upgrade.hull;

import mlc.om.upgrade.Upgrade;

public class Hull extends Upgrade implements HullInterface {

	public int maxHealth = 0;
	public int damage = 0;
	
	public Hull(int maxHealt, int price, String name, String description) {
		super(price, name, description, "Hull");
		this.maxHealth = maxHealt;
	}

	public int getMaxHealth() {
		return maxHealth;
	}

	public int getActualHealth() {
		if(isAlive())
			return maxHealth - damage;
		else
			return 0;
	}

	public boolean isAlive() {
		return maxHealth - damage > 0;
	}

	public void damage(int quantity) {
		this.damage += quantity;
		if(damage > maxHealth)
			damage = maxHealth;
	}

	@Override
	public void repair(int quantity) {
		this.damage -= quantity;
		if(damage < 0)
			damage = 0;
	}
}
